package com.lwm.utils;

import javax.servlet.http.HttpServletResponse;

public class WebUtils {

    /**
     * 将字符串渲染到客户端
     *
     * @param str      待渲染的字符串
     * @param response 渲染对象
     */
    public static void renderString(String str, HttpServletResponse response) {
        try {
            response.setStatus(200);
            response.setContentType("application/json");
            response.setCharacterEncoding("UTF-8");
            response.getWriter().write(str);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
